import { getRequest, postRequest,deleteRequest } from '@/lib/request';
export const userApi = {
	getUserInfo:()=>{
		return getRequest('/user',false)
	},
	sendCode: (phone) => {
		return postRequest('/send_code', phone)
	},
	userLogin: (param) => {
		return postRequest('/login', param)
	},
	addUserInfo: (param) => {
		return postRequest('/user/update', param)
	},
	saveOpenId: (param) => {
		return postRequest('/save/openid', param)
	},
	wxLogin: (param) => {
		return postRequest('/wx_login', param)
	},
	getRandomTopic:(cid)=>{
		return getRequest('/question-setting/random-practice?category_id='+cid)
	},
	getTopicCate:()=>{
		return getRequest('/question-setting/categories')
	},
	getAllTopic:()=>{
		return getRequest('/question-category/all')
	},
	getIsOpenTopic:()=>{
		return getRequest('/question-category/purchased')
	},
	staticTopic:(cid)=>{
		return getRequest('/question-setting/stats?category_id='+cid)
	},
	cashList:()=>{
		return getRequest('/question-category-order/casings')
	},
	//获取学校专业
	getSchool:()=>{
		return getRequest('/school/question-categories')
	},
	//填写学校专业信息
	setUserInfo:(param)=>{
		return postRequest('/user/update-info',param)
	},
	//定期考试题目
	getPeriodicList:(cid)=>{
		return getRequest('/periodic-exam/questions?category_id='+cid)
	},
	//获取考试时间信息
	getExamTime:(param)=>{
		return postRequest('/question-setting/start-exam',param)
	},
	//章节题库
	getDailyList:(cid)=>{
		return getRequest('/question-setting/daily-questions?category_id='+cid)
	},
	//章节列表
	getChapterList:(cid)=>{
		return getRequest('/question-category/chapters?category_id='+cid)
	},
	//随机练习
	getRandomList:(cid)=>{
		return getRequest('/question-setting/random-practice?category_id='+cid)
	},
	//真题考试列表
	getTrueExamList:(cid)=>{
		return getRequest('/exam/list?category_id='+cid)
	},
	getTrueExam:(eid)=>{
		return getRequest('/exam/questions?exam_id='+eid)
	},
	saveAnswers:(param)=>{
		return postRequest('/question-setting/batch-save-answer-records',param)
	},
	//添加删除收藏题目
	favQuestion:(param)=>{
		return postRequest('/question-setting/favorite/toggle',param)
	},
	//题目收藏列表
	favQuestionList:()=>{
		return getRequest('/question-setting/favorite/list')
	},
	//错题集
	errQuestion:(atype)=>{
		return getRequest('/question-setting/error-questions?answer_type='+atype)
	},
	//考试记录
	examQuestion:(cid)=>{
		return getRequest('/answer-records/exam-records?category_id='+cid)
	},
	//考试详情
	examDetail:(sid)=>{
		return getRequest(`/answer-records/submit/${sid}`)
	},
	//练习记录
	practiceQuestion:(atype)=>{
		return getRequest('/question-setting/practice-records?answer_type='+atype)
	},
	//排行榜
	rankQuestion:(cid)=>{
		return getRequest('/question-setting/answer-ranking?category_id='+cid)
	},
	//保存笔记
	saveNote:(param)=>{
		return postRequest('/question-setting/note/save',param)
	},
	//获取笔记列表
	getNoteList:()=>{
		return getRequest('/question-setting/note/get')
	},
	deleteNote:(qid)=>{
		return deleteRequest('/question-setting/note/delete?question_id='+qid)
	},
	//题库设置
	getQuestionSet:()=>{
		return getRequest('/question-setting/user-setting')
	},
	//修改随机练习题数
	setQuestionNum:(param)=>{
		return postRequest('/question-setting/update-random-question-count',param)
	},
	//保存单个题目答案
	saveSingleQuestion:(param)=>{
		return postRequest('/question-setting/save-answer-record',param)
	},
	//获取单个题目
	getSingleQuestion:(qid)=>{
		return getRequest('/question-setting/question-detail?question_id='+qid,false)
	},
	//清除所有做题记录
	clearQuestionRecords:()=>{
		return postRequest('/question-setting/clear-answer-records')
	},
	//清除所有收藏记录
	clearFavList:()=>{
		return postRequest('/question-setting/favorite/clear-all')
	},
	//清除所有笔记
	deleteAllNote:()=>{
		return deleteRequest('/question-setting/note/clear-all')
	},
};